package cn.itcast.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@EnableFeignClients(basePackages = "cn.itcast.feign.client") //开启Feign的功能,指定feign扫描feign-api下的client包
@MapperScan("cn.itcast.order.mapper")
//@EnableEurekaClient
@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) {
        // startup.cmd -m standalone
        SpringApplication.run(OrderApplication.class, args);
    }

    @Bean
    @LoadBalanced // 服务发现
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    // Eureka均衡策略，局部配置，方式一（2.配置文件）
    /*@Bean
    public IRule randomRule(){
        return new RandomRule();
    }*/
}
